package com.hsoft.zhxy.app.xtgl_02_01.mapper;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hsoft.zhxy.app.common.model.entity.JcqxGnzy;
import com.hsoft.zhxy.app.xtgl_02_01.model.query.GnzyQuery;
import com.hsoft.zhxy.app.xtgl_02_01.model.vo.GnzyVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * All rights Reserved, Designed By 哈尔滨工业大学软件工程股份有限公司
 * 
 * @Title: 功能资源 DAO层接口
 * @Package 
 * @Description: 
 * @author: system
 * @date: 2020-10-23
 */
@Mapper
@Repository
public interface JcqxGnzyMapper extends BaseMapper<JcqxGnzy> {

    @Select("select gnzy.gnzyid,\n" +
            "       gnzy.gnzymc,\n" +
            "       gnzy.zymchz,\n" +
            "       gnzy.qqlj,\n" +
            "       gnzy.fcdid,\n" +
            "       gnzy.tb,\n" +
            "       gnzy.pxh,\n" +
            "       gnzy.sfwym,\n" +
            "       gnzy.dblxbs,\n" +
            "       gnzy.dbssxyybs,\n" +
            "       mx.gnzymssl\n" +
            "  from jcqx_gnzy gnzy\n" +
            "  left join (select gnzyid, count(*) gnzymssl from jcqx_gnzymx group by gnzyid) mx\n" +
            "    on gnzy.gnzyid = mx.gnzyid\n" +
            " where gnzy.fcdid is null\n" +
            " order by pxh")
    List<GnzyVO> selectGzyList();

    @Select("select gnzy.gnzyid,\n" +
            "       gnzy.gnzymc,\n" +
            "       gnzy.zymchz,\n" +
            "       gnzy.qqlj,\n" +
            "       gnzy.fcdid,\n" +
            "       gnzy.tb,\n" +
            "       gnzy.pxh,\n" +
            "       gnzy.sfwym,\n" +
            "       gnzy.dblxbs,\n" +
            "       gnzy.dbssxyybs,\n" +
            "       gnzy.sfpdqx,\n" +
            "       mx.gnzymssl\n" +
            "  from jcqx_gnzy gnzy\n" +
            "  left join (select gnzyid, count(*) gnzymssl from jcqx_gnzymx group by gnzyid) mx\n" +
            "    on gnzy.gnzyid = mx.gnzyid\n" +
            " where gnzy.fcdid is not null\n" +
            " order by pxh")
    List<GnzyVO> selectZzyList();

}